package com.pyue.eam.regi.module.message.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pyue.eam.admin.api.entity.regi.CqTaskLibEntity;
import com.pyue.eam.common.security.util.SecurityUtils;
import com.pyue.eam.regi.module.message.entity.CqUserTaskMsgEntity;
import com.pyue.eam.regi.module.message.mapper.CqUserTaskMsgMapper;
import com.pyue.eam.regi.module.message.service.CqUserTaskMsgService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户任务消息
 *
 * @date 2023-12-29 12:25:06
 */
@Service
public class CqUserTaskMsgServiceImpl extends ServiceImpl<CqUserTaskMsgMapper, CqUserTaskMsgEntity> implements CqUserTaskMsgService {
    @Override
    public List<CqUserTaskMsgEntity> getTaskMes(Long userId, String type) {
        return baseMapper.getTaskMes(userId, type);
    }

    @Override
    public void overTaskMsgStatus(Long taskId, Long userId) {
        baseMapper.overTaskMsgStatus(taskId, userId);
    }

    @Override
    public List<CqTaskLibEntity> getTaskTodoCount(List<Long> taskIdList) {
        if (CollUtil.isEmpty(taskIdList)) {
            return CollUtil.newArrayList();
        }
        return baseMapper.getTaskTodoCount(taskIdList, SecurityUtils.getUserId());
    }
}
